Work around \-characters on Windows for now
authorAlex Crichton <alex@alexcrichton.com>
Tue, 24 Jun 2014 05:21:19 +0000 (22:21 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 24 Jun 2014 05:42:10 +0000 (22:42 -0700)
libs/toml-rs
src/cargo/core/source.rs
src/cargo/util/toml.rs
tests/test_cargo_compile.rs

index ed88ef0b8151277cc6a876f2daaeb1c63420717b..b663d6ae99294a0825f4e1b11c5b3110d56bc65f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ed88ef0b8151277cc6a876f2daaeb1c63420717b
+Subproject commit b663d6ae99294a0825f4e1b11c5b3110d56bc65f
index 4e4f3c5689290957290ca2c68eb8c990e4996826..8636acf3013801ce6d3a13e04cd6192c91f5b4cf 100644 (file)
@@ -87,7 +87,12 @@ impl SourceId {
     // Pass absolute path
     pub fn for_path(path: &Path) -> SourceId {
         // TODO: use proper path -> URL
-        let url = format!("file://{}", path.display());
+        let url = if cfg!(windows) {
+            let path = path.display().to_str();
+            format!("file://{}", path.as_slice().replace("\\", "/"))
+        } else {
+            format!("file://{}", path.display())
+        };
         SourceId::new(PathKind, url::from_str(url.as_slice()).unwrap())
     }
 
@@ -119,7 +124,11 @@ impl SourceId {
         match self.kind {
             GitKind(..) => box GitSource::new(self, config) as Box<Source>,
             PathKind => {
-                let path = Path::new(self.url.path.as_slice());
+                let mut path = self.url.path.clone();
+                if cfg!(windows) {
+                    path = path.replace("/", "\\");
+                }
+                let path = Path::new(path);
                 box PathSource::new(&path, self) as Box<Source>
             },
             RegistryKind => unimplemented!()
index 69eac3c8cd749b00a66d30cd06b343269083873c..e5fd43ee8da67dd3f5596baf72a6a4531fa8ec35 100644 (file)
@@ -37,7 +37,7 @@ pub fn parse(toml: &str, file: &str) -> CargoResult<toml::Table> {
             for error in parser.errors.iter() {
                 let (loline, locol) = parser.to_linecol(error.lo);
                 let (hiline, hicol) = parser.to_linecol(error.hi);
-                error_str.push_str(format!("{}:{}:{}{} {}",
+                error_str.push_str(format!("{}:{}:{}{} {}\n",
                                            file,
                                            loline + 1, locol + 1,
                                            if loline != hiline || locol != hicol {
index 28a7d0225ed5ea35bd0625cda6b06125440a8a71..57bd17dac9b14b2fe18e2a84433b373a67925f23 100644 (file)
@@ -62,7 +62,7 @@ test!(cargo_compile_with_invalid_manifest2 {
         execs()
         .with_status(101)
         .with_stderr("could not parse input TOML\n\
-                      Cargo.toml:3:19-3:20 expected a value\n"))
+                      Cargo.toml:3:19-3:20 expected a value\n\n"))
 })
 
 test!(cargo_compile_without_manifest {